
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@page import="gruppe7.util.Html" %>
<%@page import="gruppe7.model.User" %>
<%@page import="gruppe7.model.Model" %>
<%@page import="gruppe7.control.ServletController" %>

<%
Html html = new Html(); 
ServletController sc = ServletController.getInstance();
User user = sc.getSession(request, response).getUser();
Model model = Model.getInstance();
%>

<% out.print(html.setHeader("Lookup price")); %>

<body>
<jsp:include page="main_links.jsp" />

<div id ='content'>
<div id='content-left'>
<h3><img src='images/tickets.png'/> Lookup price</h3><br/> 

<%
if (request.getAttribute("same") != null) {
	out.println("<p class='red'>Please pick a destination station that is different from the departure station</p>");         
}

java.util.List<String> stations = null;

try {
	stations = Model.getInstance().getStationList();
}

catch (Exception e) {
	sc.sendToErrorPage(response);
}

out.println(""
        + "<p><table class='default'>"
        + "<form action='/gruppe7/ticket_price.do' method='post'>"
        + "<tr><td>Departure</td>"
        + "<td><select name='departure'>");

for (String station : stations) {

    out.println("<option value='" + station + "'>" + station + "</option>");
}

out.println("</select></td></tr></br>"
        + "<tr><td>Destination</td>"
        + "<td><select name='destination'>");

for (String station : stations) {
    out.println("<option value='" + station + "'>" + station + "</option>");
}

out.println("</select></td></tr></br>"
        + "<tr><td></td><td align='right'><input class='submit' type='submit' value='Inform me!'/></td></tr>"
        + "</form></table></p>");

%>


</div></div>

<%
out.println(html.setFooter());
%>